import axios from "axios";
import { API_NAME } from "./contants.ts";
import { Assignment } from "../index";

const getAllAssignmentByGradeIDAPI = (id: number) => {
  return axios.get(`${API_NAME}/assignment/grade/${id}`);
};

const getAllAssignmentAPI = () => {
  return axios.get(`${API_NAME}/assignment/all`);
};

const addAssignmentAPI = () => {
  return axios.post(`${API_NAME}/assignment/add`);
};

const updateAssignmentAPI = (item: Assignment) => {
  return axios.post(`${API_NAME}/assignment/update`, item);
};

const deleteAssignmentByIDAPI = (id: number) => {
  return axios.post(`${API_NAME}/assignment/delete/${id}`);
};

const addAssignmentURL = `${API_NAME}/assignment/add`;

const downAssignmentURL = `${API_NAME}/assignment/download`;

export {
  getAllAssignmentByGradeIDAPI,
  getAllAssignmentAPI,
  addAssignmentAPI,
  deleteAssignmentByIDAPI,
  updateAssignmentAPI,
  downAssignmentURL,
  addAssignmentURL,
};
